#include <kuai/sim/simjob.hpp>
#include <kuai/sim/control.hpp>

#ifndef _KUAI_SIM_MD_HPP_
#define _KUAI_SIM_MD_HPP_

namespace kuai {

	class MolecularDynamicControl 
		: public SimulationControl
	{
	public:
		XYZ* coords;
		XYZ* speeds;
		XYZ* grediants;

		RealNumber* masses;

		RealNumber* energies;
		RealNumber timestep;

		virtual void start(SimulationEnvironment& env, EnergySet& eset);

	protected:
		std::vector<RealNumber> rmasses;
	};

	class LeapFrogControl 
		: public MolecularDynamicControl
	{
	public:
		virtual void act(SimulationEnvironment& env, EnergySet& eset, size_t istep);
	};

	class VelocityVerletControl
		: public MolecularDynamicControl
	{
	public:
		virtual void act(SimulationEnvironment& env, EnergySet& eset, size_t istep);
	};

	class MolecularDynamicJob
		: public SimulationJob
	{
	public:
		MolecularDynamicJob();
		void run_md(EnergySet& efunc, ControlSet& controls, size_t nstep, RealNumber timestep=1e-15);

		std::auto_ptr<MolecularDynamicControl> md_control;
	};

}

#endif
